﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>订单详情</title>
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="yes" name="apple-touch-fullscreen">
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../css/ydui.css?v=1.1.4" rel="stylesheet" />
    <script src="../js/ydui.flexible.js"></script>
    <link rel="stylesheet" type="text/css" href="../css/all.css?v=20180302" />
    <style>
        .m-tabbar:after{border:none;}
    </style>
</head>
<body ms-controller="orderdetail" class="ms-controller">
    <div class="g-flexview">
        <header class="m-navbar">
            <a onclick="history.back()" class="navbar-item"><i class="back-ico"></i></a>
            <div class="navbar-center"><span class="navbar-title">订单详情</span></div>
        </header>
        <div class="g-scrollview">
            <div class="linkman clearfix" style="margin: 0;">
                <!--<div class="orderdetail_flow" ms-if="@ModelData.Status==1">
                    <span class="iconfont fl icon-qiacheicon" style="font-size: .4rem;color: #FF8A00;"></span>
                    <div class="detail_flowtext">
                        <p>您已在菜鸟驿站完成取件您已在菜鸟驿站完成取件您已在菜鸟驿站完成取件</p>
                        <abbr>2017-04-24  12:32:00</abbr>
                    </div>
                    <span class="iconfont fr icon-gengduo" style="color:#bbbbbb;"></span>
                </div>-->
                <div class="orderdetail_flow" >
                    <div class="detail_flowtext">
                        <p>{{@ShowStatus(@ModelData.Status)}}</p>
                    </div>
                </div>
                <span class="iconfont link_ico icon-dingwei"></span>
                <div class="link_text">
                    <p>联系人：{{@ModelData.Receiver}} <span class="fr">{{@ModelData.Telephone}} </span></p>
                    <p class="margin-t">收货地址：{{@ModelData.Address}}</p>
<!--                    <p>时间：<span>{{@ModelData.CRTime}}</span></p>
-->                </div>
            </div>
            <!--联系人方式-->
            <div class="linkdetail clearfix">
            	<p class="headtitle">商品信息</p>
                <div class="linkmall_detail" ms-for="el in @SubItem">
                    <img ms-attr="{'src':ComFunJS.FilePath(el.ImgUrl,'/154/154')}" />
                    <div class="mall_detailtext">
                        <div class="clearfix"><p class="fl price">{{el.Title}}</p><p class="fr qty">¥{{el.Price1}}</p></div>
                        <h1><span class="fr">×{{el.Qty}}</span></h1>
                    </div>
                </div>
                <div class="orderlistdetail">
                    <p class="addprice">商品合计：<span>¥{{@ModelData.Price1}}</span></p>
                </div>
                 <div class="orderlistdetail border" ms-if="@ModelData.Point>0">
                    <p class="addprice">存钱罐支付：<span>-¥{{@ModelData.Point}}</span></p>
                </div>               
                <div class="orderlistdetail ">
                    <p class="goodsprice" ms-if="@ModelData.PayStatus==1">实付：<span>¥{{@ModelData.SumPrice}}</span></p>
                    <p class="goodsprice" ms-if="@ModelData.PayStatus==0">待支付：<span>¥{{@ModelData.SumPrice}}</span></p>
                </div>    
            </div>
            <div class="orderlistdetail border" style="margin-top: .2rem;">
                <p class="goodsprice">订单信息</p>
            </div>
            <div class="orderlistdetail">
                <p class="addprice">订单编号：{{@ModelData.ID}}</p>
                <p class="addprice">创建时间：{{@ModelData.CRTime}}</p>
                <p class="addprice" ms-if="@ModelData.PayStatus==1">付款时间：{{@ModelData.PayTime}}</p>
            </div>           
        </div>
        <div class="m-tabbar">
			<div class="order-again">
				<a ms-if="@ModelData.Status==2">查看物流</a>
				<a class="change" ms-if="@ModelData.Status==2" ms-on-tap="@ConfirmOrder(el)">确认收货</a>
                <a style="display:block;" ms-if="@ModelData.Status==0" ms-on-tap="@CancelOrder(@ID)">取消订单</a>
                <a class="change"style="display:block;" ms-if="@ModelData.Status==0&&@ModelData.PayStatus==0" ms-attr="{'href':'pay.html?id='+@ID}">去支付</a>
			</div>	        	
        </div>
    </div>

    <script src="//cdn.bootcss.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="../js/ydui.js"></script>
    <script src="../js/avalon.mobile.min.js"></script>
    <script src="../js/ComFunJS.js?v=20180331"></script>
    <script>
        var model = avalon.define({
            $id: "orderdetail",
            ModelData: {},
            SubItem:[],
            ID: ComFunJS.getQueryString("id"),
            GetModelData: function () {
                $.getJSON("/api/order/model/" + model.ID, function (r) {
                    model.ModelData = r.result[0];
                    model.SubItem = r.result[0].SubItem;
                })
            },
            ShowStatus: function (s) {
                var st = "";
                switch (s) {
                    case 0:
                        st = "待付款";
                        break;
                    case 1:
                        st = "待发货";
                        break;
                    case 2:
                        st = "待收货";
                        break;
                    case 3:
                        st = "确认收货";
                        break;
                    case 9:
                        st = "已取消";
                        break;
                }
                return st;
            },
            CancelOrder: function (el) {
                YDUI.dialog.confirm("", "确定要取消该订单吗?", function () {
                    $.getJSON("/api/order/status/cancel/" + el.ID, function (r) {
                        if (r.error == "") {
                            el.Status = 9;
                            YDUI.dialog.toast("订单取消成功", "none", 1000);
                        }
                    })
                })

            }
        })
        avalon.ready(function () {

            //if (ComFunJS.isLogin(true)) {
            model.GetModelData()
            //}

        })



    </script>
</body>
</html>
